﻿using System.Collections.Generic;
using System.Linq;
using Missbot.Common;
using Missbot.Core.CrossingRoute;

namespace Missbot.AIModule.Pet.PetAgainst
{
    /// <summary>
    /// 宠物技能服务
    /// </summary>
    public class PetSkillSvc : ISingleton, IDataMgr, IViewable, ILearnable
    {
        public List<PetSkill> AllSkills { get; set; }

        public PetSkill this[string name] => AllSkills.FirstOrDefault(p => p.Name == name);
        
        public void RefreshData()
        {
            AllSkills = PetSkillDA.GetAll();
        }

        public (bool canView, string viewCommand) ViewableCheck(string name)
        {
            return this[name] == null ? (false, null) : (true, "查看宠物技能");
        }

        public (bool canLearn, string learnCommand) LearnableCheck(string name)
        {
            return this[name] == null ? (false, null) : (true, "升级宠物技能");
        }
    }
}